<template>
  <div>
    <van-search v-model="value" placeholder="请输入搜索关键词" />
    <van-card
      v-for="item in data"
      :key="item.id"
      :desc="item.name"
      :title="item.title"
      :thumb="item.url"
      @click="index(item)"
    />
  </div>
</template>

<script setup>
import axios from "axios";
import { ref } from "vue";
import { useRouter } from "vue-router";
let router = new useRouter();
const value = ref("");
let data = ref([]);
const goget = async () => {
  const resp = await axios.get("/api/room/list");
  console.log("resp", resp.data);
  data.value = resp.data.data.list;
};
const index = (v) => {
  router.push({
    path: "/home/" + v.id,
    query: v,
  });
};
goget();
</script>

<style lang="scss" scoped>
</style>